<template>
    <a-table :columns="columns" :data-source="data" :pagination="false">
        <template #headerCell="{ column }">
            <template v-if="column.key === 'name'">
                <span>
                    <smile-outlined />
                    Name
                </span>
            </template>
        </template>

        <template #bodyCell="{ column, record }">
            <template v-if="column.key === 'name'">
                <a>
                    {{ record.name }}
                </a>
            </template>
            <template v-else-if="column.key === 'tags'">
                <span>
                    <a-tag v-for="tag in record.tags" :key="tag"
                        :color="tag === 'loser' ? 'volcano' : tag.length > 5 ? 'geekblue' : 'green'">
                        {{ tag.toUpperCase() }}
                    </a-tag>
                </span>
            </template>
            <template v-else-if="column.key === 'action'">
                <!-- <a-button type="link" @click="edit(record.id)">编辑</a-button> -->
                <AntdZh>
                    <a-popconfirm title="确定删除 ?" @confirm="emit('delete',record.id)">
                        <a-button type="link" danger>删除</a-button>
                    </a-popconfirm>
                </AntdZh>
            </template>
        </template>
    </a-table>
</template>
<script setup>
import { SmileOutlined, DownOutlined } from '@ant-design/icons-vue';
import userApp from '@/hooks'
const { $ } = userApp()
const emit = defineEmits(['delete','update'])
const props = defineProps({
    data: {
        type: Array,
    }
})

const columns = [
    {
        title: '成果标题',
        dataIndex: 'achievementTitle',
    },
    {
        title: '负责人',
        dataIndex: 'leader',
    },
    {
        title: '成果转化收入',
        dataIndex: 'achievementFund',
    },
    {
        title: '发表时间',
        dataIndex: 'publicationDate',
    },
    {
        title: '工作量',
        dataIndex: 'workload',
    },
    // {
    //     title: '排序',
    //     dataIndex: 'orderNum',
    // },
    {
        title: '操作',
        key: 'action',
        dataIndex: 'action',
    },
];


</script>
  
  